import React from 'react';
import { Tabs,Card,Row,Col,Modal, Button, Collapse, Form, Input,InputNumber, Select, Radio,DatePicker,Spin,Icon } from 'antd';
import {idCardRegex, mobileRegex, telRegex} from "../../../utils/globalConst";
import Utils from './../../../utils/utils';
import moment from 'moment';
import Axios from "../../../axios";
import './index.less';
import {message} from "antd/lib/index";
const TabPane = Tabs.TabPane;
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const Option = Select.Option;
const TextArea = Input.TextArea;
const CardGrid = Card.Grid;
const Panel = Collapse.Panel;

export default class UserDetails extends React.Component{
    state = {
        updateInfoModal:{
            visible: false,
            confirmLoading: false,
        },
        moreInfoModal:{
            visible: false,
            confirmLoading: false,
        }
    }
    componentDidMount(){
        //获取用户id
        let id = this.props.match.params.id;
        if(id){
            console.log("id:"+id);
            let params = {
                id,
            }
            this.setState({
                userId:id
            })
            this.detailsRequest(params);
        }
    }
    //tab切换
    handleChangeTab = (activeKey)=>{
        const userId = this.state.userId;
        console.log(activeKey)  //resume  简历
        if (activeKey=='resume') {
            let params = {userId}
            let resumeBaseInfo = this.state.resumeBaseInfo; //基础简历信息
            if (!resumeBaseInfo) {
                this.resumeBaseRequest(params)
            }
        }
    }
    //切换 Panel
    //TODO 2019-01-10 17:54:03
    handleChangePan = (e)=>{
        console.log(e)
        if (e.length) {
            let params = {
                resumeId:this.state.resumeBaseInfo.id,
                type:e[0],
            }
            this.resumeItemRequest(params)
        }
    }
    //编辑简历基础信息
    handleUpdateBaseInfo = ()=>{
        this.setState({
            updateInfoModal:{
                ...this.state.updateInfoModal,
                visible:true,
            }
        })
    }
    //简历基础信息 表单提交
    handleUpdateInfoSubmit = ()=>{
        const _form = this.updateInfoForm.props.form;
        _form.validateFields((err, values) => {
            if (err) {
                return;
            }
            console.log(values)
            const birthDate = values['birthDate']?values['birthDate'].format('YYYY-MM-DD'):'';
            const beginIndustryJobTime = values['beginIndustryJobTime']?values['beginIndustryJobTime'].format('YYYY-MM-DD')+' 00:00:00':'';
            const beginJobTime = values['beginJobTime']?values['beginJobTime'].format('YYYY-MM-DD')+' 00:00:00':'';
            const eduGraduateTime = values['eduGraduateTime']?values['eduGraduateTime'].format('YYYY-MM-DD')+' 00:00:00':'';
            let params = {
                ...values,
                birthDate,
                beginIndustryJobTime,
                beginJobTime,
                eduGraduateTime
            }
            params = Utils.FilterParam(params); //过滤掉为空的参数
            console.log(params)
            this.updateInfoRequest(params)
        });
    }
    //补充信息
    handleAddInfo = () =>{
        this.setState({
            moreInfoModal:{
                ...this.state.moreInfoModal,
                visible:true,
            }
        })
    }
    //补充信息编辑 表单提交
    handleMoreInfoSubmit = ()=>{
        const _form = this.moreInfoForm.props.form;
        _form.validateFields((err, values) => {
            console.log(values);
            if (err) {
                return;
            }
            if (values.beginTime){
                values.beginTime=moment(values.beginTime).format("YYYY-MM-DD HH:mm:ss");
            }
            if (values.endTime){
                values.endTime=moment(values.endTime).format("YYYY-MM-DD HH:mm:ss");
            }
            let params = Utils.FilterParam(values); //过滤掉为空的参数
            this.createMoreInfoRequest(params)
        });
    }

    /*查询用户详情请求*/
    detailsRequest = (params)=>{
        this.setState({
            loading:true,
            loadingTxt:'加载中...'
        })
        Axios.dataRequest({
            block:'/hr',
            url:'/user/detail',
            params:params,
        }).then((data)=>{
            console.log(data)
            let baseInfo = data.data;
            this.setState({
                loading:false,
                baseInfo,
            })
        }).catch((error)=>{
            this.setState({ loading:false })
            console.log(error);
        })
    }
    /*查询用户简历基础信息*/
    resumeBaseRequest = (params)=>{
        this.setState({
            loading:true,
            loadingTxt:'加载中...'
        })
        Axios.dataRequest({
            block:'/hr',
            url:'/account/resume',
            params:params,
        }).then((data)=>{
            console.log(data)
            let resumeBaseInfo = data.data;
            this.setState({
                loading:false,
                resumeBaseInfo,
            })
        }).catch((error)=>{
            this.setState({ loading:false })
            console.log(error);
        })
    }
    /*创建或更新简历基础信息 请求*/
    updateInfoRequest = (params)=>{
        this.setState({
            updateInfoModal:{
                ...this.state.updateInfoModal,
                confirmLoading: true,
            }
        })
        Axios.formRequest({
            block:'/hr',
            url:'/account/resume',
            params:params,
        }).then((data)=>{
            console.log(data)
            this.setState({
                updateInfoModal:{
                    ...this.state.updateInfoModal,
                    visible: false,
                    confirmLoading: false,
                }
            },()=>{
                message.success('简历基础信息更新成功！',2,()=>{
                    //let _params = Utils.FilterParam(this.initParams); //过滤掉为空的参数
                    let userId = this.state.userId;
                    let _params = {
                        id:userId
                    }
                    this.resumeBaseRequest(_params)
                    //window.location.reload()
                });
            })
        }).catch((error)=>{
            console.log(error);
            this.setState({
                updateInfoModal:{
                    ...this.state.updateInfoModal,
                    confirmLoading: false,
                }
            })
        })
    }
    /*创建用户简历项 请求*/
    //TODO 2019-01-10 17:49:34
    createMoreInfoRequest = (params)=>{
        this.setState({
            moreInfoModal:{
                ...this.state.moreInfoModal,
                confirmLoading: true,
            }
        })
        Axios.formRequest({
            block:'/hr',
            url:'/account/resumeItem',
            params:params,
        }).then((data)=>{
            console.log(data)
            this.setState({
                moreInfoModal:{
                    ...this.state.moreInfoModal,
                    visible: false,
                    confirmLoading: false,
                }
            },()=>{
                message.success('添加补充信息成功！',2,()=>{
                    //window.location.reload()
                });
                /* let userId = this.state.userId;
                 let _params = {
                     id:userId
                 }
                 this.resumeBaseRequest(_params)*/
            })
        }).catch((error)=>{
            console.log(error);
            this.setState({
                moreInfoModal:{
                    ...this.state.moreInfoModal,
                    confirmLoading: false,
                }
            })
        })
    }
    /*查询用户简历项列表*/
    resumeItemRequest = (params)=>{
        this.setState({
            loading:true,
            loadingTxt:'加载中...'
        })
        Axios.dataRequest({
            block:'/hr',
            url:'/account/resumeItem',
            params:params,
        }).then((data)=>{
            console.log(data)
            //let baseInfo = data.data;
            this.setState({
                loading:false,
                //baseInfo,
            })
        }).catch((error)=>{
            this.setState({ loading:false })
            console.log(error);
        })
    }
    render(){
        const userBaseInfo = this.state.baseInfo||'';
        const resumeBascInfo = this.state.resumeBaseInfo||'';
        const genderDic = {
            'MAN':'男',
            'WOMAN':'女',
            'SECRECY':'保密',
        }
        const BascInfo = ()=>{
            return (
                <div className="basic-info common-details">
                    <Row>
                        <Col>
                            <div className="avatar"><img src="/assets/avatar.jpg" alt=""/></div>
                        </Col>
                    </Row>
                    <Row>
                        <Col sm={8} className="item"><span className="title">序号：</span><span className="details">{userBaseInfo.userNo}</span></Col>
                        <Col sm={8} className="item"><span className="title">名称：</span><span className="details">{userBaseInfo.name}</span></Col>
                        <Col sm={8} className="item"><span className="title">登录账号：</span><span className="details">{userBaseInfo.account}</span></Col>
                    </Row>
                    <Row>
                        <Col sm={8} className="item"><span className="title">真实姓名：</span><span className="details">{userBaseInfo.realname?userBaseInfo.realname:'—'}</span></Col>
                        <Col sm={8} className="item"><span className="title">身份证号码：</span><span className="details">{userBaseInfo.idcard?userBaseInfo.idcard:'—'}</span></Col>
                        <Col sm={8} className="item"><span className="title">生日：</span><span className="details">{userBaseInfo.birthDate?moment(userBaseInfo.birthDate).format("YYYY-MM-DD"):'—'}</span></Col>
                    </Row>
                    <Row>
                        <Col sm={8} className="item"><span className="title">性别：</span><span className="details">{genderDic[userBaseInfo.gender]}</span></Col>
                        <Col sm={8} className="item"><span className="title">手机号码：</span><span className="details">{userBaseInfo.mobile?userBaseInfo.mobile:'—'}</span></Col>
                        <Col sm={8} className="item"><span className="title">邮箱：</span><span className="details">{userBaseInfo.email?userBaseInfo.email:'—'}</span></Col>
                    </Row>
                    <Row>
                        <Col sm={8} className="item"><span className="title">入职时间：</span><span className="details">{userBaseInfo.hiredate?moment(userBaseInfo.hiredate).format("YYYY-MM-DD"):'—'}</span></Col>
                        <Col sm={8} className="item"><span className="title">行业工作时间：</span><span className="details">{userBaseInfo.beginIndustryJobTime?moment(userBaseInfo.beginIndustryJobTime).format("YYYY-MM-DD"):'—'}</span></Col>
                        <Col sm={8} className="item"><span className="title">行业工作年限：</span><span className="details">{userBaseInfo.serviceYear}</span></Col>
                    </Row>
                    <Row>
                        <Col sm={8} className="item"><span className="title">教育背景：</span><span className="details">{userBaseInfo.eduBackground?userBaseInfo.eduBackground:'—'}</span></Col>
                        <Col sm={8} className="item"><span className="title">职称：</span><span className="details">{userBaseInfo.jobTitle?userBaseInfo.jobTitle:'—'}</span></Col>
                        <Col sm={8} className="item"><span className="title">职位：</span><span className="details">{userBaseInfo.position?userBaseInfo.position:'—'}</span></Col>
                    </Row>
                    <Row>
                        <Col sm={8} className="item"><span className="title">岗位：</span><span className="details">{userBaseInfo.jobTitle?userBaseInfo.jobTitle:'—'}</span></Col>
                        <Col sm={8} className="item"><span className="title">部门：</span><span className="details">{userBaseInfo.position?userBaseInfo.position:'—'}</span></Col>
                    </Row>
                    <Row>
                        <Col sm={8} className="item"><span className="title">账号注册时间：</span><span className="details">{userBaseInfo.createTime}</span></Col>
                        <Col sm={8} className="item"><span className="title">信息更新时间：</span><span className="details">{userBaseInfo.updateTime}</span></Col>
                    </Row>
                </div>
            )
        }
        const Resume = ()=>{
            return (
                <div className="resume-box">
                    <Card title="基础资料" bordered={false} extra={<a href="javascript:;" className="btn-txt-primary" onClick={this.handleUpdateBaseInfo}>编辑基础资料</a>}>
                        <table className="common-dataTab" border="1">
                            <tbody>
                            <tr>
                                <th>姓名</th>
                                <td>{resumeBascInfo.realname?resumeBascInfo.realname:'—'}</td>
                                <th>性别</th>
                                <td>{genderDic[resumeBascInfo.gender]}</td>
                                <th>手机号码</th>
                                <td>{resumeBascInfo.mobile?resumeBascInfo.mobile:'—'}</td>
                                <th>邮箱</th>
                                <td>{resumeBascInfo.email?resumeBascInfo.email:'—'}</td>
                            </tr>
                            <tr>
                                <th>座机</th>
                                <td>{resumeBascInfo.tel?resumeBascInfo.tel:'—'}</td>
                                <th>通信地址</th>
                                <td>{resumeBascInfo.address?resumeBascInfo.address:'—'}</td>
                                <th>微信</th>
                                <td>{resumeBascInfo.wechat?resumeBascInfo.wechat:'—'}</td>
                                <th>qq</th>
                                <td>{resumeBascInfo.qq?resumeBascInfo.qq:'—'}</td>
                            </tr>
                            <tr>
                                <th>名族</th>
                                <td>{resumeBascInfo.nationality?resumeBascInfo.nationality:'—'}</td>
                                <th>籍贯</th>
                                <td>{resumeBascInfo.birthPlace?resumeBascInfo.birthPlace:'—'}</td>
                                <th>政治面貌</th>
                                <td>{resumeBascInfo.politicalStatus?resumeBascInfo.politicalStatus:'—'}</td>
                                <th>生日</th>
                                <td>{resumeBascInfo.birthDate?resumeBascInfo.birthDate:'—'}</td>
                            </tr>
                            <tr>
                                <th>婚姻状态</th>
                                <td>{resumeBascInfo.marriageStatus?resumeBascInfo.marriageStatus:'—'}</td>
                                <th>身份证</th>
                                <td>{resumeBascInfo.idcard?resumeBascInfo.idcard:'—'}</td>
                                <th>学历</th>
                                <td>{resumeBascInfo.eduBackground?resumeBascInfo.eduBackground:'—'}</td>
                                <th>毕业学校</th>
                                <td>{resumeBascInfo.eduSchool?resumeBascInfo.eduSchool:'—'}</td>
                            </tr>
                            <tr>
                                <th>学制</th>
                                <td>{resumeBascInfo.eduSystem?resumeBascInfo.eduSystem:'—'}</td>
                                <th>学位</th>
                                <td>{resumeBascInfo.eduQualification?resumeBascInfo.eduQualification:'—'}</td>
                                <th>专业</th>
                                <td>{resumeBascInfo.eduMajor?resumeBascInfo.eduMajor:'—'}</td>
                                <th>毕业时间</th>
                                <td>{resumeBascInfo.eduGraduateTime?moment(resumeBascInfo.eduGraduateTime).format("YYYY-MM-DD"):'—'}</td>
                            </tr>
                            <tr>
                                <th>开始工作时间</th>
                                <td>{resumeBascInfo.beginJobTime?moment(resumeBascInfo.beginJobTime).format("YYYY-MM-DD"):'—'}</td>
                                <th>本行工作时间</th>
                                <td>{resumeBascInfo.beginIndustryJobTime?moment(resumeBascInfo.beginIndustryJobTime).format("YYYY-MM-DD"):'—'}</td>
                                <th>身高</th>
                                <td>{resumeBascInfo.height?resumeBascInfo.height:'—'}</td>
                                <th>体重</th>
                                <td>{resumeBascInfo.weight?resumeBascInfo.weight:'—'}</td>
                            </tr>
                            <tr>
                                <th>身体状态</th>
                                <td>{resumeBascInfo.physicalStatus?resumeBascInfo.physicalStatus:'—'}</td>
                                <th>特长</th>
                                <td>{resumeBascInfo.specialty?resumeBascInfo.specialty:'—'}</td>
                                <th>奖励</th>
                                <td>{resumeBascInfo.rewards?resumeBascInfo.rewards:'—'}</td>
                                <th>惩罚</th>
                                <td>{resumeBascInfo.punishment?resumeBascInfo.punishment:'—'}</td>
                            </tr>
                            </tbody>
                        </table>
                    </Card>
                    <Card title="补充信息" bordered={false} extra={<a href="javascript:;" className="btn-txt-primary" onClick={this.handleAddInfo}>添加补充信息</a>}>
                        <Collapse bordered={false} onChange={(e)=>this.handleChangePan(e)}>
                            <Panel header="工作经历" key="JOB">
                                <p>2015——现在，一直在酱游科技工作</p>
                            </Panel>
                            <Panel header="教育经历" key="EDU">
                                <p>省级先锋人物，十大感动中国人物</p>
                            </Panel>
                            <Panel header="培训经历" key="TRAIN">
                                <p>省级先锋人物，十大感动中国人物</p>
                            </Panel>
                            <Panel header="进修进取经历" key="FURTHER_EDU">
                                <p>2015年在新东方培训</p>
                            </Panel>
                            <Panel header="考证情况" key="CERTIFICATE">
                                <p>无</p>
                            </Panel>
                        </Collapse>
                    </Card>
                </div>
            )
        }
        return (
            <div className="info-box">
                <Spin spinning={this.state.loading} size="large" tip={this.state.loadingTxt}>
                    <Card
                        bordered={false}
                    >
                        <Tabs
                            defaultActiveKey="baseInfo"
                            animated={false}
                            onChange={(activeKey)=>this.handleChangeTab(activeKey)}
                        >
                            <TabPane tab="基础信息" key="baseInfo">
                                <BascInfo/>
                            </TabPane>
                            <TabPane tab="简历信息" key="resume">
                                <Resume/>
                            </TabPane>
                        </Tabs>

                    </Card>
                </Spin>
                <Modal title="简历基础信息"
                       width={1200}
                       visible={this.state.updateInfoModal.visible}
                       onOk={this.handleUpdateInfoSubmit}
                       okText="确认修改"
                       confirmLoading={this.state.updateInfoModal.confirmLoading}
                       onCancel={()=>{
                           this.setState({
                               updateInfoModal:{
                                   ...this.state.updateInfoModal,
                                   visible:false
                               }
                           })
                       }}
                       destroyOnClose={true}
                >
                    <UpdateInfoForm baseInfo={this.state.baseInfo} resumeBaseInfo={this.state.resumeBaseInfo} wrappedComponentRef={(updateInfoForm)=>{this.updateInfoForm = updateInfoForm;}}/>
                </Modal>
                <Modal title="补充信息编辑"
                       visible={this.state.moreInfoModal.visible}
                       onOk={this.handleMoreInfoSubmit}
                       okText="确认"
                       confirmLoading={this.state.moreInfoModal.confirmLoading}
                       onCancel={()=>{
                           this.setState({
                               moreInfoModal:{
                                   ...this.state.moreInfoModal,
                                   visible:false
                               }
                           })
                       }}
                       destroyOnClose={true}
                >
                    <MoreInfoForm resumeBaseInfo={this.state.resumeBaseInfo} wrappedComponentRef={(moreInfoForm)=>{this.moreInfoForm = moreInfoForm;}}/>
                </Modal>
            </div>
        )
    }
}

//更新用户基础简历表单
class UpdateInfoForm extends React.Component{
    state = {}
    componentWillMount(){
    }
    render(){
        const { getFieldDecorator } = this.props.form;
        const formItemLayout = {
            labelCol: {span: 7},
            wrapperCol: {span: 16}
        };
        const baseInfo = this.props.baseInfo;   //用户详情
        delete baseInfo.id;
        const resumeBaseInfo = this.props.resumeBaseInfo;   //简历基本信息
        const info = resumeBaseInfo?resumeBaseInfo:baseInfo;    // resumeBaseInfo 为空代表为创建基础简历
        return (
            <div className="layout-form-three">
                <div className="left-div" style={{minWidth:375}}>
                    <Form>
                        <FormItem {...formItemLayout} style={{display:'none'}}>
                            {
                                getFieldDecorator('id',{
                                    initialValue:info.id
                                })(
                                    <Input type="hidden" placeholder=""/>
                                )
                            }
                        </FormItem>
                        <FormItem label="姓名" {...formItemLayout}>
                            {
                                getFieldDecorator('realname',{
                                    initialValue:info.realname,
                                    rules: [{ required: true, message: '请填写姓名!' }],
                                })(
                                    <Input type="text" placeholder="姓名"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="性别" {...formItemLayout}>
                            {
                                getFieldDecorator('gender',{
                                    initialValue:info.gender,
                                    rules: [{ required: true, message: '请选择性别!' }],
                                })(
                                    <RadioGroup>
                                        <Radio value="MAN">男</Radio>
                                        <Radio value="WOMAN">女</Radio>
                                        <Radio value="SECRECY">保密</Radio>
                                    </RadioGroup>
                                )
                            }
                        </FormItem>
                        <FormItem label="手机号码" {...formItemLayout}>
                            {
                                getFieldDecorator('mobile',{
                                    initialValue:info.mobile,
                                    rules: [
                                        { required: true, message: '请填写手机号码!' },
                                        { pattern:mobileRegex,message:"手机号格式不正确"}
                                    ],
                                })(
                                    <Input type="text" placeholder="手机号码（格式：13612341234）"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="邮箱" {...formItemLayout}>
                            {
                                getFieldDecorator('email',{
                                    initialValue:info.email,
                                    rules: [
                                        { required: true, message: '请填写邮箱!' },
                                        { type: 'email', message: '邮箱格式不正确!',}
                                    ],
                                })(
                                    <Input type="text" placeholder="邮箱"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="座机" {...formItemLayout}>
                            {
                                getFieldDecorator('tel',{
                                    initialValue:info.tel,
                                })(
                                    <Input type="text" placeholder="座机（格式：区号-12341234）"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="通信地址" {...formItemLayout}>
                            {
                                getFieldDecorator('address',{
                                    initialValue:info.address,
                                })(
                                    <TextArea type="text" placeholder="通信地址" autosize/>
                                )
                            }
                        </FormItem>
                        <FormItem label="微信" {...formItemLayout}>
                            {
                                getFieldDecorator('wechat',{
                                    initialValue:info.wechat,
                                })(
                                    <Input type="text" placeholder="微信"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="qq" {...formItemLayout}>
                            {
                                getFieldDecorator('qq',{
                                    initialValue:info.qq,
                                })(
                                    <Input type="text" placeholder="qq"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="名族" {...formItemLayout}>
                            {
                                getFieldDecorator('nationality',{
                                    initialValue:info.nationality,
                                })(
                                    <TextArea type="text" placeholder="名族" autosize/>
                                )
                            }
                        </FormItem>
                    </Form>
                </div>
                <div className="middle-div" style={{minWidth:375}}>
                    <Form>
                        <FormItem label="籍贯" {...formItemLayout}>
                            {
                                getFieldDecorator('birthPlace',{
                                    initialValue:info.birthPlace,
                                })(
                                    <Input type="text" placeholder="籍贯"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="政治面貌" {...formItemLayout}>
                            {
                                getFieldDecorator('politicalStatus',{
                                    initialValue:info.politicalStatus,
                                })(
                                    <Select placeholder="政治面貌">
                                        <Option value="党员">党员</Option>
                                        <Option value="预备党员">预备党员</Option>
                                        <Option value="共青团员">共青团员</Option>
                                        <Option value="群众">群众</Option>
                                    </Select>
                                )
                            }
                        </FormItem>
                        <FormItem label="生日" {...formItemLayout}>
                            {
                                getFieldDecorator('birthDate',{
                                    initialValue:moment(info.birthDate),
                                    rules: [{ required: true, message: '请填写生日!' }],
                                })(
                                    <DatePicker
                                        format="YYYY-MM-DD"
                                        placeholder="生日"
                                    />
                                )
                            }
                        </FormItem>
                        <FormItem label="婚姻状态" {...formItemLayout}>
                            {
                                getFieldDecorator('marriageStatus',{
                                    initialValue:info.marriageStatus,
                                })(
                                    <Input type="text" placeholder="婚姻状态"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="身份证" {...formItemLayout}>
                            {
                                getFieldDecorator('idcard',{
                                    initialValue:info.idcard,
                                    rules:[{ pattern:idCardRegex,message:"身份证号码格式不正确"}],
                                })(
                                    <Input type="text" placeholder="身份证"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="学历" {...formItemLayout}>
                            {
                                getFieldDecorator('eduBackground',{
                                    initialValue:info.eduBackground,
                                })(
                                    <Input type="text" placeholder="学历"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="毕业学校" {...formItemLayout}>
                            {
                                getFieldDecorator('eduSchool',{
                                    initialValue:info.eduSchool,
                                })(
                                    <Input type="text" placeholder="毕业学校"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="学制" {...formItemLayout}>
                            {
                                getFieldDecorator('eduSystem',{
                                    initialValue:info.eduSystem,
                                })(
                                    <Input type="text" placeholder="学制"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="学位" {...formItemLayout}>
                            {
                                getFieldDecorator('eduQualification',{
                                    initialValue:info.eduQualification,
                                })(
                                    <Input type="text" placeholder="学位"/>
                                )
                            }
                        </FormItem>
                    </Form>
                </div>
                <div className="right-div" style={{minWidth:375}}>
                    <Form>
                        <FormItem label="专业" {...formItemLayout}>
                            {
                                getFieldDecorator('eduMajor',{
                                    initialValue:info.eduMajor,
                                })(
                                    <Input type="text" placeholder="专业"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="毕业时间" {...formItemLayout}>
                            {
                                getFieldDecorator('eduGraduateTime',{
                                    initialValue:moment(info.eduGraduateTime),
                                })(
                                    <DatePicker
                                        format="YYYY-MM-DD"
                                        placeholder="毕业时间"
                                    />
                                )
                            }
                        </FormItem>
                        <FormItem label="开始工作时间" {...formItemLayout}>
                            {
                                getFieldDecorator('beginJobTime',{
                                    initialValue:moment(info.beginJobTime),
                                    rules: [{ required: true, message: '请填写开始工作时间!' }],
                                })(
                                    <DatePicker
                                        format="YYYY-MM-DD"
                                        placeholder="开始工作时间"
                                    />
                                )
                            }
                        </FormItem>
                        <FormItem label="本行工作时间" {...formItemLayout}>
                            {
                                getFieldDecorator('beginIndustryJobTime',{
                                    initialValue:moment(info.beginIndustryJobTime),
                                    rules: [{ required: true, message: '请填写本行工作时间!' }],
                                })(
                                    <DatePicker
                                        format="YYYY-MM-DD"
                                        placeholder="本行工作时间"
                                    />
                                )
                            }
                        </FormItem>
                        <FormItem label="身高" {...formItemLayout}>
                            {
                                getFieldDecorator('height',{
                                    initialValue:info.height!=0?info.height:'',
                                })(
                                    <Input type="text" placeholder="身高/cm"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="体重" {...formItemLayout}>
                            {
                                getFieldDecorator('weight',{
                                    initialValue:info.weight!=0?info.weight:'',
                                })(
                                    <Input type="text" placeholder="体重/kg"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="身体状态" {...formItemLayout}>
                            {
                                getFieldDecorator('physicalStatus',{
                                    initialValue:info.physicalStatus,
                                })(
                                    <Input type="text" placeholder="身体状态"/>
                                )
                            }
                        </FormItem>
                        <FormItem label="特长" {...formItemLayout}>
                            {
                                getFieldDecorator('specialty',{
                                    initialValue:info.specialty,
                                })(
                                    <TextArea type="text" placeholder="特长" autosize/>
                                )
                            }
                        </FormItem>
                        <FormItem label="奖励" {...formItemLayout}>
                            {
                                getFieldDecorator('rewards',{
                                    initialValue:info.rewards,
                                })(
                                    <TextArea type="text" placeholder="奖励" autosize/>
                                )
                            }
                        </FormItem>
                        <FormItem label="惩罚" {...formItemLayout}>
                            {
                                getFieldDecorator('punishment',{
                                    initialValue:info.punishment,
                                })(
                                    <TextArea type="text" placeholder="惩罚" autosize/>
                                )
                            }
                        </FormItem>
                    </Form>
                </div>
            </div>
        );
    }
}
UpdateInfoForm = Form.create({})(UpdateInfoForm);

//编辑简历项表单
class MoreInfoForm extends React.Component{
    state = {
        type:'JOB',
    }
    componentWillMount(){
    }
    handleChange = (val)=>{
        this.setState({
            type:val
        })
    }
    render(){
        const { getFieldDecorator } = this.props.form;
        const formItemLayout = {
            labelCol: {span: 7},
            wrapperCol: {span: 16}
        };
        const type = this.state.type;
        const resumeId = this.props.resumeBaseInfo.id;
        return (
            <div>
                <Form>
                    <FormItem label="简历编号" {...formItemLayout} style={{display:"none"}}>
                        {
                            getFieldDecorator('resumeId',{
                                initialValue:resumeId
                            })(
                                <Input type="hidden" placeholder=""/>
                            )
                        }
                    </FormItem>
                    <FormItem label="补充信息类型" {...formItemLayout}>
                        {
                            getFieldDecorator('type',{
                                initialValue:"JOB"
                            })(
                                <Select placeholder="补充信息类型" style={{minWidth:150}} onChange={(val)=>this.handleChange(val)}>
                                    <Option key="JOB" value="JOB">工作经历</Option>
                                    <Option key="EDU" value="EDU">教育经历</Option>
                                    <Option key="TRAIN" value="TRAIN">培训经历</Option>
                                    <Option key="FURTHER_EDU" value="FURTHER_EDU">进修进取经历</Option>
                                    <Option key="CERTIFICATE" value="CERTIFICATE">考证情况</Option>
                                </Select>
                            )
                        }
                    </FormItem>
                </Form>
                {
                    type=='JOB'?
                        <Form>
                            <FormItem {...formItemLayout} style={{display:'none'}}>
                                {
                                    getFieldDecorator('id',{
                                    })(
                                        <Input type="hidden" placeholder=""/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="标题" {...formItemLayout}>
                                {
                                    getFieldDecorator('title',{
                                        rules: [{ required: true, message: '请填写标题!' }],
                                    })(
                                        <Input type="text" placeholder="标题"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="所在公司" {...formItemLayout}>
                                {
                                    getFieldDecorator('companyName',{
                                    })(
                                        <Input type="text" placeholder="所在公司"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="所在部门" {...formItemLayout}>
                                {
                                    getFieldDecorator('department',{
                                    })(
                                        <Input type="text" placeholder="所在部门"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="开始时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('beginTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="开始时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="结束时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('endTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="结束时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="职务" {...formItemLayout}>
                                {
                                    getFieldDecorator('position',{
                                    })(
                                        <Input type="text" placeholder="职务"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="内容描述" {...formItemLayout}>
                                {
                                    getFieldDecorator('content',{
                                        rules: [{ required: true, message: '请填写内容描述!' }],
                                    })(
                                        <TextArea type="text" placeholder="内容描述" autosize/>
                                    )
                                }
                            </FormItem>
                        </Form>
                        :<div></div>
                }
                {/*教育经历*/}
                {
                    type=='EDU'?
                        <Form>
                            <FormItem {...formItemLayout} style={{display:'none'}}>
                                {
                                    getFieldDecorator('id',{
                                    })(
                                        <Input type="hidden" placeholder=""/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="标题" {...formItemLayout}>
                                {
                                    getFieldDecorator('title',{
                                        rules: [{ required: true, message: '请填写标题!' }],
                                    })(
                                        <Input type="text" placeholder="标题"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="学校" {...formItemLayout}>
                                {
                                    getFieldDecorator('companyName',{
                                    })(
                                        <Input type="text" placeholder="学校"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="专业" {...formItemLayout}>
                                {
                                    getFieldDecorator('department',{
                                    })(
                                        <Input type="text" placeholder="专业"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="开始时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('beginTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="开始时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="结束时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('endTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="结束时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="内容描述" {...formItemLayout}>
                                {
                                    getFieldDecorator('content',{
                                        rules: [{ required: true, message: '请填写内容描述!' }],
                                    })(
                                        <TextArea type="text" placeholder="内容描述" autosize/>
                                    )
                                }
                            </FormItem>
                        </Form>
                        :<div></div>
                }
                {/*培训经历*/}
                {
                    type=='TRAIN'?
                        <Form>
                            <FormItem {...formItemLayout} style={{display:'none'}}>
                                {
                                    getFieldDecorator('id',{
                                    })(
                                        <Input type="hidden" placeholder=""/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="标题" {...formItemLayout}>
                                {
                                    getFieldDecorator('title',{
                                        rules: [{ required: true, message: '请填写标题!' }],
                                    })(
                                        <Input type="text" placeholder="标题"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="所在机构" {...formItemLayout}>
                                {
                                    getFieldDecorator('companyName',{
                                    })(
                                        <Input type="text" placeholder="所在机构"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="开始时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('beginTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="开始时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="结束时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('endTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="结束时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="内容描述" {...formItemLayout}>
                                {
                                    getFieldDecorator('content',{
                                        rules: [{ required: true, message: '请填写内容描述!' }],
                                    })(
                                        <TextArea type="text" placeholder="内容描述" autosize/>
                                    )
                                }
                            </FormItem>
                        </Form>
                        :<div></div>
                }
                {/*进修进取经历*/}
                {
                    type=='FURTHER_EDU'?
                        <Form>
                            <FormItem {...formItemLayout} style={{display:'none'}}>
                                {
                                    getFieldDecorator('id',{
                                    })(
                                        <Input type="hidden" placeholder=""/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="标题" {...formItemLayout}>
                                {
                                    getFieldDecorator('title',{
                                        rules: [{ required: true, message: '请填写标题!' }],
                                    })(
                                        <Input type="text" placeholder="标题"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="所在机构" {...formItemLayout}>
                                {
                                    getFieldDecorator('companyName',{
                                    })(
                                        <Input type="text" placeholder="所在机构"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="开始时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('beginTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="开始时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="结束时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('endTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="结束时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="内容描述" {...formItemLayout}>
                                {
                                    getFieldDecorator('content',{
                                        rules: [{ required: true, message: '请填写内容描述!' }],
                                    })(
                                        <TextArea type="text" placeholder="内容描述" autosize/>
                                    )
                                }
                            </FormItem>
                        </Form>
                        :<div></div>
                }
                {/*考证情况*/}
                {
                    type=='CERTIFICATE'?
                        <Form>
                            <FormItem {...formItemLayout} style={{display:'none'}}>
                                {
                                    getFieldDecorator('id',{
                                    })(
                                        <Input type="hidden" placeholder=""/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="标题" {...formItemLayout}>
                                {
                                    getFieldDecorator('title',{
                                        rules: [{ required: true, message: '请填写标题!' }],
                                    })(
                                        <Input type="text" placeholder="标题"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="所在机构" {...formItemLayout}>
                                {
                                    getFieldDecorator('companyName',{
                                    })(
                                        <Input type="text" placeholder="所在机构"/>
                                    )
                                }
                            </FormItem>
                            <FormItem label="开始时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('beginTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="开始时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="结束时间" {...formItemLayout}>
                                {
                                    getFieldDecorator('endTime',{
                                    })(
                                        <DatePicker
                                            format="YYYY-MM-DD"
                                            placeholder="结束时间"
                                        />
                                    )
                                }
                            </FormItem>
                            <FormItem label="内容描述" {...formItemLayout}>
                                {
                                    getFieldDecorator('content',{
                                        rules: [{ required: true, message: '请填写内容描述!' }],
                                    })(
                                        <TextArea type="text" placeholder="内容描述" autosize/>
                                    )
                                }
                            </FormItem>
                        </Form>
                        :<div></div>
                }
            </div>
        );
    }
}
MoreInfoForm = Form.create({})(MoreInfoForm);